package ro.k.servlets;

import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import ro.k.tags.ComandaManopera;

/**
 * Servlet implementation class KAjax
 */
@WebServlet("/KAjax")
public class KAjax extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public KAjax() {
		super();
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
	 *      response)
	 */
	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {

		HttpSession sess = request.getSession();
		ComandaManopera tagCmd = (ComandaManopera) sess
				.getAttribute("tagCmdMan");

		Object v = request.getParameter("v");
		Object id = request.getParameter("id");
		tagCmd.updateManoperaComanda(id.toString(),
				Double.parseDouble(v.toString()));
		OutputStream os = response.getOutputStream();
		os.write(23);
	}

}
